<?php
/**
 * DotHerbert
 *
 * @package    Core
 * @subpackage Stub
 * @copyright  2009 extreme-programmers
 * @license    http://dotherbert.extreme-programmers.com/license   BSD License
 * @version    $Id:$
 */

namespace dotherbert\core\stub;

/**
 * Date stub
 *
 * @package    Core
 * @subpackage Stub
 * @author     Johannes Trink <johannes.trink@extreme-programmers.com>
 */
class DateStub extends Stub
{
    /**
     * Instance
     *
     * @var DotHerbert\Core\Stub\DateStub
     */
    protected static $instance;

    /**
     * Set instance
     *
     * @param  DotHerbert\Core\Stub\DateStub
     * @return void
     */
    public static function setInstance(self $instance)
    {
        self::$instance = $instance;
    }

    /**
     * Gm date
     *
     * @param  string $format
     * @param  int    $timestamp
     * @return string
     */
    public function gmdate($format, $timestamp = null)
    {
        if (null === $timestamp) {
            return gmdate($format);
        } else {
            return gmdate($format, $timestamp);
        }
    }
}